import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * 用户类
 */

public class Player extends Role {
    public int grades = 0;

    @Override
    public int generatNumbers() {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入一个数，0：石头，1：剪刀，2：布");
        int number;
        while (true) {
            try {
                number = scan.nextInt();
                if (number < 0 || number > 2) {
                    System.out.println("请输入0-2的数字");
                    continue;
                }
                break;
            } catch (InputMismatchException e) {
                System.out.println("请输入数字");
                scan.next();
            }
        }
        return number;
    }
}
